<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Hello MUI</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="mui.min.css">
</head>

<body>
  
</body>

</html>


<script>
    $(function () {
        var arr = [];
        Ajax('getinlanddiscount', function (info) {
            // 合并数据
            info.result.forEach(function (v, i) {
                arr.push(v)
            })
            info = { result: arr }
            console.log(info)
            //渲染数据
            $('.mm-content').html(template('tmp', info))
        })
        //监听页面卷曲距离
        $(window).on('scroll', function (e) {
            var h = $(document).scrollTop();

            if (arr.length >= 80) {
                //移出监听事件  结束代码
                $(window).off('scroll');
                return;
            }

            if (h > $('.items').height() - $(window).height()) {

                Ajax('getinlanddiscount', function (info) {
                    // 合并数据
                    info.result.forEach(function (v, i) {
                        arr.push(v)
                    })

                    info = { result: arr }
                    console.log(info)
                    //渲染数据
                    $('.mm-content').html(template('tmp', info))
                })
            }
        })


    })



</script>